# 事件管理页面操作
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage


class CaseManager(KeyWords):
    '''
    事件管理页面相关的操作
    '''
    url = KeyWords.url + 'event-management/list'

    def look_by_case_from(self):
        '''
        根据事件来源查询事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\case_from.yaml')
        element_operation(self, data[0]['data'])

    def look_by_case_type(self):
        '''
        根据事件类型筛选事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\case_type.yaml')
        element_operation(self, data[0]['data'])

    def look_by_case_stage(self):
        '''
        根据事件阶段筛选事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\case_stage.yaml')
        element_operation(self, data[0]['data'])

    def look_by_case_status(self):
        '''
        根据事件状态查看事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\case_status.yaml')
        element_operation(self, data[0]['data'])

    def look_by_case_time_and_keyword(self):
        '''
        根据事件时间查看事件列表
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\look_by_case_time_and_keyword.yaml')
        element_operation(self, data[0]['data'])

    def look_by_case_urgency_sort(self):
        '''
        根据点击紧急待办 超期未办 正常 所有 查看事件 然后排序
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\look_by_case_urgency_sort.yaml')
        element_operation(self, data[0]['data'])

    def look_case_detail(self):
        '''
        查看事件详情接口测试
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\look_case_detail.yaml')
        element_operation(self, data[0]['data'])

    def look_case_already(self):
        '''
        # 查看已处理、 已过期、 未配置流程事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\case_manager\look_case_already.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    driver = choose_browser()
    L = LonginPage(driver)
    L.login('kobeAdmin002', 'kobe8888')
    case = CaseManager(driver)
    case.look_by_case_type()
    driver.quit()
